<template>
  <Page :show-nav-bar="false" v-slot:default="{contentClass}">
    <div :class="contentClass" class="flex flex-col justify-center items-center">
      <div>{{message.message}}</div>
    </div>
  </Page>
</template>

<script setup>
import {ref} from 'vue';
import {useStore} from "vuex";
import {useRoute, useRouter} from "vue-router";
import Page from "../components/Page.vue"
import {computed, onMounted, watch} from "vue";

import apis from '../apis'

const store = useStore()
const router = useRouter()
const route = useRoute()
const message = ref({})

const user = computed(() => store.state.user)

onMounted(async () => {
  await apis.right.writeOff({activity_id: route.query.activity_id, code: route.query.code}, {
    label: 'write_off',
    show_loading: true,
  }).then(({data: result}) => {
    message.value = {error: false, message: result.message}
  }).catch((res) => {
    message.value = {error: true, message: res.message || "核销失败"}
  })
})
</script>

<style scoped>

</style>